package com.xc.h05.service.renMengBinService.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xc.h05.entity.Coursetype;
import com.xc.h05.mapper.CoursetypeMapper;
import com.xc.h05.service.renMengBinService.CoursetypeRMBService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CoursetypeRMBServiceImpl implements CoursetypeRMBService {
    @Autowired
    private CoursetypeMapper coursetypeMapper;
    @Override
    public PageInfo<Coursetype> findAll(int pageNum, int pageSize, Coursetype coursetype) {
        PageHelper.startPage(pageNum, pageSize);
        List<Coursetype> coursetypes = coursetypeMapper.selectAll(coursetype);
        PageInfo<Coursetype> pageInfo = new PageInfo<>(coursetypes);
        return pageInfo;
    }

    @Override
    public int deleteById(Long id) {
        int i = coursetypeMapper.deleteByPrimaryKey(id);
        return i;
    }

    @Override
    public int add(Coursetype coursetype) {
        int i = coursetypeMapper.insert(coursetype);
        return i;
    }

    @Override
    public int update(Coursetype coursetype) {
        int i = coursetypeMapper.updateByPrimaryKey(coursetype);
        return i;
    }

    @Override
    public int deleteByIds(List<Long> ids) {
        int i = coursetypeMapper.deleteByIds(ids);
        return i;
    }
}
